/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

/*!
  \file capabilitiesManager.h
  \brief header file for XML parser

  \author Jack Elston
  $Date: 2006/10/25 13:34:45 $
  */

#ifndef __CAPABILITESMANAGER_H
#define __CAPABILITESMANAGER_H

#include <unistd.h>
#include <signal.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <netinet/in.h>	// struct sockaddr_in
#include <sys/socket.h>
#include <arpa/inet.h>

#include "String.h"
#include "type_defs.h"
#include "command.h"

/*<-------Defines--------->*/
/*<------End Defines------>*/

#define MAX_NUM_CAP 32

typedef struct _Capabilities_t{
	SystemCharacter_t * systems [MAX_NUM_CAP];

	_Capabilities_t() { for(int i=0; i<MAX_NUM_CAP; i++) systems[i] = NULL; }
} __attribute__ ((packed))Capabilities_t;

class CapabilitiesManager
{
	private:
		Capabilities_t capabilities;

		int find(SystemCharacter_t* a_system);

	public:
		CapabilitiesManager();
		~CapabilitiesManager();

		bool add(SystemCharacter_t* a_system);
		bool remove(SystemCharacter_t* a_system);

		bool find(uint8_t a_system_id);
		SystemCharacter_t * get(uint8_t num);
		void getCapabilities(uint8_t * buf);
		void printCapabilities(void);
};

#endif //define
